package com.thf.controller.news;

import com.alibaba.fastjson.JSON;
import com.thf.service.NewsService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.ServletException;
import java.io.IOException;
import java.util.Map;

@Controller
public class NewGetCountController {

    @Resource
    private NewsService newsService ;

//    @RequestMapping("/news/count")
    @ResponseBody
    protected Integer newGetCount(String val) throws ServletException, IOException {

        Map map = JSON.parseObject(val, Map.class);
        Integer count = newsService.getCount(map);
        //System.out.println(count);
//       反馈给前端--返回值
//        resp.getWriter().println(count);
        return count ;
    }
}
